import React, { Component, useState, useEffect } from "react"
import {
    PageHeader,
    Button
} from "antd"
import { axios } from "&/axios"
const PreviewPure = (props) => {
    const [advise, setAdvise] = useState(null)
    useEffect(() => {
        axios.post("/api/getoneadvisebyid", {
            _id: props.match.params.id
        }).then(res => {
            if (res.data.type) {
                setAdvise(res.data.result)
            }
        })
    })
    return (
        advise && <div style={{ border: "2px solid #ccc", width: "60%", height: "100%"}}>
            <PageHeader
                className="site-page-header"
                onBack={() => props.history.go(-1)}
                
                title={advise.title}
                subTitle={advise.category.join("/")}    
            />
           
           <div style={{display:"flex",justifyContent: "spaceBetween",borderBottom:"2px solid #ccc",height:50,alignItems:"center"}}>
         
            <span style={{flex:"1",fontSize:20,color:"#0066CC"}}>&nbsp;&nbsp;&nbsp;&nbsp;提议人:&nbsp;&nbsp;&nbsp;&nbsp;{advise.userinfo.username}</span>
           </div>
            <div
                style={{
                    marginTop: 30,
                    marginLeft: 30,
                    width: 400,
                    height: 300,
                    // border: "2px solid orange",
                    borderRadius: 10,
                }}
                dangerouslySetInnerHTML={{
                    __html: advise.content
                }}
            >

            </div>
        </div>
    )
}




export default PreviewPure